package qeug.shsh.facde;

import kd.bos.context.RequestContext;

/**
 * @program: laxv-cosmic
 * @author: Lang
 * @create: 2024-07-17 09:36
 * @description: 上下文copy
 **/
public class RequestContextService {
    public static RequestContext copy(RequestContext rc, String userId) {
        RequestContext copy = RequestContext.create();
        if (rc != null) {
            copy.setRequestId(rc.getRequestId());
            copy.setTraceId(rc.getTraceId());
            copy.setSandboxId(rc.getSandboxId());
            copy.setClient(rc.getClient());
            copy.setUserAgent(rc.getUserAgent());
            copy.setGlobalSessionId(rc.getGlobalSessionId());
            copy.setLocalSessionId(rc.getLocalSessionId());
            copy.setTenantId(rc.getTenantId());
            copy.setTenantCode(rc.getTenantCode());
            copy.setUserId(userId);
            copy.setOrgId(rc.getOrgId());
            copy.setUserName(rc.getUserName());
            copy.setUserType(rc.getUserType());
            copy.setUserOpenId(rc.getUserOpenId());
            copy.setClientFullContextPath(rc.getClientFullContextPath());
            copy.setClientContextPath(rc.getClientContextPath());
            copy.setClientUrl(rc.getClientUrl());
            copy.setQueryString(rc.getQueryString());
            copy.setLang(rc.getLang());
            copy.setTenantInfo(rc.getTenantInfo());
            copy.setLoginIP(rc.getLoginIP());
            copy.setLoginTime(rc.getLoginTime());
            copy.setDebugInfo(rc.getDebugInfo());
            copy.setYzjAppId(rc.getYzjAppId());
            copy.setYzjAppTicket(rc.getYzjAppTicket());
            copy.setAccountId(rc.getAccountId());
            copy.setUid(rc.getUid());
            copy.setTccBranchId(rc.getTccBranchId());
            copy.setTccTransactionId(rc.getTccTransactionId());
            copy.setAccCompanyId(rc.getAccCompanyId());
            copy.setApi3rdAppId(rc.getApi3rdAppId());
            copy.setBizPartnerId(rc.getBizPartnerId());
            copy.setAuthType(rc.getAuthType());
        }
        return copy;
    }
}
